
/*
=====================================================================
  MAIN.C: main routine for ANSIC parser
  Verion 1.0
  By Xing Liu
  Copyright(c) Abraxas Software Inc. (R), 1988, All rights reserved

=====================================================================
*/
#include "protos.h"

#include "global.h"

#include <stdio.h>
#include <stdlib.h>

void yyerror(char *);

FILE *fopen(), *fin;
int  c, lineno;
int debug = 0; /* enable for diagnostics */

void main(argc, argv)
int   argc;
char *argv[];
{


  if (argc < 2) {
    yyerror("Usage: acc <program>");
    exit(1);
  }

  fin = fopen(argv[1], "r");
  if (fin == NULL) {
    yyerror("Can't open source program file");
    exit(1);
  }

  c = getc(fin);

  if (yyparse()) {
    yyerror("Error(s) found by the parser");
    exit(1);
  } else {
    fprintf(stdout, "No syntax error was found by the parser\n");
  }

  fclose(fin);
}

void yyerror(char *s)
{
  fprintf(stderr, "%s\n", s);
}





